home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_09_1986_Transactor_Publishing.d64
/
projectile c64
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
788b
|
36 lines
100 rem* bouncing ball simulation *
110 :
120 ymax=237: xmax=327
130 fv=1.4 :rem forward velocity
140 uv=100 :rem initial upward velocity
150 y1=0 :rem y start position
160 x=10 :rem x start position
170 g=-32.2:rem gravity in feet/s/s
180 dc=.9 :rem elasticity of "ball"
190 t=0 :rem time starts at 0
200 :
210 gosub 410 'create sprite shape
220 :
230 vic=53248 :rem vic video chip
240 poke vic+21,1 :rem enable sprite 0
250 poke 2040,14 :rem sprite shape
260 sx=vic: sy=vic+1: xhi=vic+16
270 :
280 :
290 rem-- main loop --
300 x=x+fv
310 y=y1 + uv*t +.5*g*(t*t)
320 if y<y1 then y=y1:t=0:uv=uv*dc
330 poke sx,x and 255:poke xhi,-(x>256)
340 poke sy,ymax-y
350 t=t+.2
360 if x<=xmax then 300
370 end
380 :
390 :
400 rem** create sprite shape at 896 **
410 fori=896to959:pokei,0:next
420 fori=925to935step3:reada:pokei,a:next
430 data 24,126,126,24
440 return